package com.d0330;
import java.io.*;
import java.net.Socket;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class TCPClient {
    public static void main(String[] args) {

        try {
            while(true) {
                Socket socket = new Socket("127.0.0.1", 4700);
                BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                String line = br.readLine();
                DataOutputStream os = new DataOutputStream(socket.getOutputStream());
                DataInputStream is = new DataInputStream(socket.getInputStream());
                os.writeUTF(line);
                os.flush();
                Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
                Matcher matcher = pattern.matcher(line);
                break;

            }
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}